/**
 * 编辑-报修记录表js
 */

$(function () {
    //时间选择器
    laydate.render({
        elem: '#repairTimeId',
        type: 'datetime'
    });
});

var vm = new Vue({
	el:'#dpLTE',
	data: {
		projectRepairRecord: {
			id: 0,
            reporter: {},
            reporterId: {},
            repairTime: formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss'),
            hospitalId: '0',
            faultClassificationId: '0',
            repairStatusId: '0',
            resolvingStatusId: '0',
		},
        optionsHospital: [],
        optionsFaultClassification: [],
        optionsRepairStatus: [],
        optionsResolvingStatus: [],
	},
	methods : {
		setForm: function() {
			$.SetForm({
				url: '../../project/repair/info?_' + $.now(),
		    	param: vm.projectRepairRecord.id,
		    	success: function(data) {
		    		vm.projectRepairRecord = data;
		    	}
			});
		},
		acceptClick: function() {
			if (!$('#form').Validform()) {
		        return false;
		    }
		    $.ConfirmForm({
		    	url: '../../project/repair/update?_' + $.now(),
		    	param: vm.projectRepairRecord,
		    	success: function(data) {
		    		$.currentIframe().vm.load();
		    	}
		    });
		},

        getHospitals: function () {
            $.getJSON("/sys/macro/value?_" + $.now() + "&value=客户", function (r) {
                vm.optionsHospital = r;
            });
        },
        getFaultClassifications: function () {
            $.getJSON("/sys/macro/value?_" + $.now() + "&value=故障分类", function (r) {
                vm.optionsFaultClassification = r;
            });
        },
        getRepairStatus: function () {
            $.getJSON("/sys/macro/value?_" + $.now() + "&value=报修状态", function (r) {
                vm.optionsRepairStatus = r;
            });
        },
        getResolvingStatus: function () {
            $.getJSON("/sys/macro/value?_" + $.now() + "&value=解决状态", function (r) {
                vm.optionsResolvingStatus = r;
            });
        },
	}
})
vm.getHospitals();
vm.getFaultClassifications();
vm.getRepairStatus();
vm.getResolvingStatus();